<template>
    <div class="MyHead">
        <van-nav-bar :title="title" fixed placeholder>
            <template #left v-if="isleft">
                <slot>
                    <div @click="goback()">
                        <van-icon name="arrow-left" />
                        <span style="color:#1989fa">返回</span>
                    </div>
                </slot>
            </template>
            <template #right v-if="isrigth">
                <van-icon name="search" size="18" @click="gotopushwhere('/search')" />
                <!-- <van-popover v-model:show="showPopover" :actions="actions" @select="onSelect">
                    <template #reference>
                        <van-icon name="ellipsis" />
                    </template>
                </van-popover> -->
            </template>
        </van-nav-bar>
    </div>
</template>

<script setup>
// import {useRouter} from 'vue-router'
// let router=useRouter()
//     let searchHandler=()=>{
//         router.push("/search")
//     }
import { useCommon } from "@/hooks/Common.js"

let { gotopushwhere, goback} = useCommon()

const props = defineProps({   // 接受来自父组件的props 
    title: {
        type: String,
        default: '标题'
    },
    isrigth: {
        type: Boolean,
        default: true,
    },
    isleft: {
        type: Boolean,
        default: true,
    }

})




</script>

<style lang="scss" scoped>

</style>